< previous page page_604 next page >

Page 604
Listing 15.4. continued
SELECT * FROM OtherTitles;
// now close this database
dbClose;
// ********************************************************
// create a new database
dbMake sqlvb05.mdb;
// create a new table
CREATE TABLE JobTitles
   (JobCounter COUNTER,
    JobID TEXT(5) CONSTRAINT PKJobTitle PRIMARY KEY,
    JobName TEXT(20),
    JobPay CURRENCY,
    JobDesc MEMO
   );
// insert some data
INSERT INTO JobTitles (JobID, JobName, JobDesc, JobPay) VALUES
   ('J001',
    'President',
    'Presides over the company',
    '50000'
   );
INSERT INTO JobTitles (JobID, JobName, JobDesc, JobPay) VALUES
   ('J002',
    'Vice President',
    'Does what the President tells him to do',
    '40000'
   );
INSERT INTO JobTitles (JobID, JobPay, JobName) VALUES
   ('J003',
    '35000',
    'Chief Engineer'
   );
// create a second table to hold some of the info from JobTitles
CREATE TABLE JobReport
   (JobID TEXT(5) CONSTRAINT PKJobReport PRIMARY KEY,
    JobName TEXT(20),
    JobDesc MEMO
   );
// now append records from JobTitles into JobReport
INSERT INTO JobReport
   SELECT JobID, JobName, JobDesc FROM JobTitles;

// display results
SELECT * FROM JobTitles;
SELECT * FROM JobReport;
// now append data from one database to another
INSERT INTO OtherTitles IN "sqlvb05b.mdb" "Access"
   SELECT JobID, JobName, JobDesc, JobPay FROM JobTitles;
// close this db
dbClose;
// open other db
dbOpen sqlvb05b.mdb
// show updated table
SELECT * FROM OtherTitles;
// eof

 
< previous page page_604 next page >

If you like this book, buy it!